﻿@page "/Rpt/Dashboard/Details"
@using nERP.ViewModel.Rpt.DashboardVMs
@using System.ComponentModel.DataAnnotations
@inherits BasePage

<div>
    <ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
        <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
            <Display @bind-Value="@Model.Entity.Monthly" ShowLabel="true" />
            <Display @bind-Value="@Model.Entity.PoAmount" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.PoAmounted" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.SoAmount" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.SoAmounted" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.PayAmount" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.PayAmounted" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.ReceivableAmount" ShowLabel="true" FormatString="0.##" />
            <Display @bind-Value="@Model.Entity.ReceivableAmounted" ShowLabel="true" FormatString="0.##" />
        </Row>

        <div class="modal-footer table-modal-footer">
            <Button OnClick="OnClose" Text="@WtmBlazor.Localizer["Sys.Close"]" />
        </div>

    </ValidateForm>

</div>



@code {
    [Parameter]
    public string id { get; set; }
    [Parameter]
    public string[] ids { get; set; }
    private DashboardVM Model = new DashboardVM();
    private ValidateForm vform { get; set; }
    private async Task Submit(EditContext context)
    {


        await PostsForm(vform, "/api/Rpt/Dashboard/Edit", (s) => "Sys.OprationSuccess");
    }
    public void OnClose()
    {
        CloseDialog();
    }

    protected override async Task OnInitializedAsync()
    {


        if (id != "")
        {
            var rv = await WtmBlazor.Api.CallAPI<DashboardVM>($"/api/Rpt/Dashboard/{id}");
            Model = rv.Data;
        }

        await base.OnInitializedAsync();
    }
}
